





from django.contrib.auth.models import Permission, Group
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet

from apps.meiduo_admin.serializers.groups import GroupViewSerializer
from apps.meiduo_admin.serializers.permission import PermissionSerializer
from apps.meiduo_admin.utils import PageNum

######用户组管理##########
class GroupView(ModelViewSet):
    # 指定序列化器
    serializer_class = GroupViewSerializer
    # 指定查询集
    queryset = Group.objects.all()
    #指定分页器
    pagination_class = PageNum



    ####获取用户权限内容

    def simple(self,request):
        # 1.查询权限表
        data = Permission.objects.all()
        # 2.返回权限
        ser = PermissionSerializer(data,many=True)
        return Response(ser.data)
